package vn.gq.tym.storytemplate;

import vn.gq.tym.fragment.CategoryFragment;
import vn.gq.tym.fragment.ChapterFragment;
import vn.gq.tym.widget.ITabHost;
import vn.gq.tym.widget.tab.BaseFragment;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;

public class MainActivity extends BaseActivity implements ITabHost {

	BaseFragment mFragment;
	int mStackLevel = 1;
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		
		FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
//		ChapterFragment fragment = ChapterFragment.newInstance(1, "");
		CategoryFragment fragment = CategoryFragment.newInstance();
		ft.add(fragment.getContainerId(), fragment);
		ft.commit();
	}

	@Override
	public void setCurrentFragment(Fragment fragment) {
		mFragment = (BaseFragment) fragment;
	}

	@Override
	public void onBackPressed() {
		if (mFragment != null) {
			mFragment.onBackPressed();
		} else {
			super.onBackPressed();
		}
	}
	
	
	
	
}
